package com.tkjt.pms.modules.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import com.tkjt.pms.modules.repos.service.BasicDataCalcService;

import lombok.extern.slf4j.Slf4j;

/**
 * 基础数据计算定时器
 */
@Slf4j
public class BasicDataCalcJob implements Job {
    @Autowired
    BasicDataCalcService basicDataCalcService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    	log.info("scheduled fire time=",jobExecutionContext.getScheduledFireTime());
        String[] dataTypes = {"kpi","budget"};
        for(String dataType : dataTypes){
            String indexGroup = "C";
        	log.info("scheduled indexGroup=",indexGroup);
            basicDataCalcService.basicDataCalc(indexGroup,dataType, null, null);
            indexGroup = "G";
        	log.info("scheduled indexGroup=",indexGroup);
            basicDataCalcService.basicDataCalc(indexGroup,dataType, null, null);
        	log.info("scheduled indexGroup end.");
        }
    	log.info("scheduled end.");
    }
}
